﻿

using OpenCvSharp;

using System;

using Xc.DataAccess.CodeReader.Properties;
using Xc.DataAccess.Core;

namespace Xc.DataAccess.CodeReader.Models.Filters
{
    /// <summary>
    /// 求俩个图片之间的差别
    /// </summary>
    [Filter("求俩个图片之间的差别",FilterType.Algorithm)]
    public class AlgorithmDifferent : FilterBase
    {
        /// <summary>
        /// 待比较的Mat
        /// </summary>
        [InputParameter("待比较的Mat")]
        public Mat OtherMat { get; set; } = new Mat();
        /// <summary>
        /// 比较后的结果
        /// </summary>
        [OutputParameter("比较后的结果")]
        public Mat ResultMat { get; set; } = new Mat();
        internal override ResultData<Mat> UseChannel(Mat mat, FilterBase[] filterInfos, FilterBase preFilterBase)
        {
            Cv2.Absdiff(mat, OtherMat, ResultMat);
            return ResultData<Mat>.Accept(TextResource.filter_compare_complete, ResultMat);
        }
    }
}
